/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.qdu.servlet;

import com.qdu.entity.Admin;
import com.qdu.service.AdminService;
import com.qdu.service.impl.AdminServiceImpl;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author 24959
 */
@WebServlet("/mapw")
public class ModifyAdminPassWordServlet extends HttpServlet{
    AdminService as=new AdminServiceImpl();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        int Ano = Integer.parseInt(req.getParameter("Ano"));
        String Apwd = req.getParameter("Apwd");
 
        Admin admin = new Admin(Ano,Apwd); 

        int rows = as.modifyAdminPassWord(admin);
        
        //resp.getWriter().print(rows);
        if(rows==1){
            req.getRequestDispatcher("/modifyApwdsuccess.jsp").forward(req, resp);
        }else{
            req.getRequestDispatcher("/modifyApwddefeat.jsp").forward(req, resp);
        }
    }

   
}
